package com.czk.netty.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.LineBasedFrameDecoder;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/4/21 11:37
 */
public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        // 换行符号解码器
        socketChannel.pipeline().addLast(new LineBasedFrameDecoder(1024));
        //
        socketChannel.pipeline().addLast(new MyNettyHandler());
    }
}
